#!/bin/sh
set -eu

CONFFILE="@MEMO_PREFIX@/etc/shairport-sync.conf"

case "$1" in
  (remove)
    /bin/launchctl unload @MEMO_PREFIX@/Library/LaunchDaemons/com.mikebrady.shairport-sync.plist
    ;;
  (purge)
    /bin/launchctl unload @MEMO_PREFIX@/Library/LaunchDaemons/com.mikebrady.shairport-sync.plist
    @MEMO_PREFIX@@MEMO_SUB_PREFIX@/bin/dpkg-statoverride --remove ${CONFFILE} || test $? -eq 2
    ;;
  (*)
    exit 0
    ;;
esac

exit 0
